﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chaos.messages
{
    public class process_server_info : message
    {
        public override void process(context in_context)
        {
            view.manager m = System.Windows.Application.Current.FindResource("view_manager") as view.manager;
            if (m != null)
            {
                view.connect.connect c = m.Controls["connect_control"] as view.connect.connect;
                if (c != null)
                {
                    view.connect.connect.AddServerInfoEvent e = new view.connect.connect.AddServerInfoEvent();
                    e.IPEndPoint = in_context.IPEndPoint;
                    e.IPEndPoint.Port = network.gameserver.Port;
                    c.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
                        new view.connect.connect.OnAddServerInfoDelegate(c.connect_OnAddServerInfo), e);
                }
            }
        }

        public override void serialize(stream.stream in_Stream)
        {
            in_Stream.begin("process_server_info")

            .end();
        }
    }
}
